package com.lbx.kafka;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @description:
 * @author: lbx
 * @create: 2018/7/12 13:57
 **/
@SpringBootApplication
@EnableScheduling
@Slf4j
public class KafkaApplication {

    @Autowired
    private KafkaSender kafkaSender;

    public static void main(String[] args) {
        SpringApplication.run(KafkaApplication.class);
    }

    //然后每隔1分钟执行一次
    @Scheduled(fixedRate = 1000)
    public void testKafka() throws Exception {
        log.info("send start.......");
        kafkaSender.sendTest();
    }
}
